home *** CD-ROM | disk | FTP | other *** search
/ Software of the Month Club 1996 November / Software of the Month Club 1996 November.iso / pc / dos / edu / fracexp / create.ftf < prev    next >
Encoding:
Text File  |  1996-06-17  |  9.1 KB  |  260 lines

  1. |rFractals|w are created by |giterating|w processes.
  2. One of the simplest fractals is known as the |rvon Koch
  3. curve.
  4. |wTo create a von Koch curve, start with a line segment.
  5. ─────────
  6. Divide this segment into three sections:
  7. ───  ───  ───
  8. Now, replace the middle section with a triangle:
  9. ───/`\───
  10. Break each of these 4 new segments into three
  11. segments.
  12. Replace the |ymiddle section|w of each segment with
  13. |yanother triangle.|w
  14.  
  15. As the following graphics show, the line gets more
  16. and more complex as you replace each existing
  17. segment with a triangle.|r
  18.  
  19. @Press [ENTER] to see more iterations...
  20. ~koch1.pcx
  21. ~koch2.pcx
  22. |wWhen iterated an infinite number of times,
  23. The von Koch curve becomes both self similar and
  24. infinite in detail, two properties of |rfractals.
  25.  
  26. @Press [ENTER] to create more elaborate fractals...
  27. |wHere is a quick review of iterating functions.
  28. |rREAL FUNCTIONS
  29. |wlet |yf(x) |g= |yx²
  30. |wlet |yx0 |g= |y2
  31.        |yx1 |g= |yf(x0) |g= |r2² |g= |r4
  32.        |yx2 |g= |yf(x1) |g= |yf(f(x0))    |g= |yf²(x0) |g= |r4²  |g= |r16
  33.        |yx3 |g= |yf(x2) |g= |yf(f(f(x0))) |g= |yfÇ(x0) |g= |r16² |g= |r256
  34.  
  35.        |r2, 4, 16, 256, ··· |wis the orbit of |yx0 |g= |r2
  36.  
  37. |wlet |yf(x) |g= |rx²
  38. |wlet |y  x0 |g= |r0.5
  39.        |y  x1 |g= |rf(x0) |g= |y0.5²   |g= |r0.25
  40.        |y  x2 |g= |rf(x1) |g= |yf²(x0) |g= |r0.25²  = |r0.125
  41.        |y  x3 |g= |rf(x2) |g= |yfÇ(x0) |g= |r0.125² = |r0.0625
  42.  
  43.        |r0.5, 0.25, 0.125, 0.0625, ··· |wis the orbit of |yx0 |g= |r0.5
  44.  
  45. |wlet |yf(x) |g= |rx²
  46. |wlet |yx0   |g= |r1
  47.        |yx1 |g= |rf(x0) |g= |y1² = 1
  48.        |yx2 |g= |rf(x1) |g= |yf²(x0)   |g= |r1² |g= |r1
  49.        |yx3 |g= |rf(x2) |g= |yfÇ(x0) |g= |r1² |g= |r1
  50.  
  51.        |r1, 1, 1, 1, ··· |wis the orbit of |yx0 |g= |r1
  52.  
  53. @
  54. This gives us the square rules for |rREAL NUMBERS|w:
  55. |y1. |wif |yx0 |g> |r1|w, the orbit |yescapes to infinity
  56. 2. |wif |yx0 |g< |r1|w, the orbit |ygoes to 0
  57. 3. |wif |yx0 |g= |r1|w, the orbit |yremains at 1|w
  58.  
  59. Now, lets look at iterated |rcomplex|w functions.
  60. Note, that |yz |wis a |rcomplex|w number, written
  61. in the form |rz = x + yi|w
  62. Look at this example of a complex iterated square² function:
  63.  
  64. |wlet |yf(z) |g= |yz²
  65. |wlet   |yz0 |g= |r1 + 2i
  66.        |yz1 |g= |yf(z0) |g= |r(1 + 2i)² |g= |r-3 + 4i
  67.        |yz2 |g= |yf(z1) |g= |yf²(z0)    |g= |r(-3 + 4i)² |g= |r-7 - 24i
  68. |w        :
  69.           :
  70.           |yz5 |g= |yf(z4) |g= |r-98248054847 - 116749235904i
  71.  
  72.        |r1 + 2i,  -3 + 4, -7 - 24i, ··· |wis the orbit for |yz0 |g= |r1 + 2i
  73.  
  74. |wlet |yf(z) |g= |yz²
  75. |wlet   |yz0 |g= |r0.1 - 0.5i
  76.        |yz1 |g= |yf(z0) |g= |r(0.1 - 0.5i)² |g= |r-0.24 - 0.1i
  77.        |yz2 |g= |yf(z1) |g= |rf²(z0)      |g= |r(0.24 - 0.1i)² |g= |r0.476 + 0.48i
  78. |w       :
  79.         :
  80.         |yz5 |g= |yf(z4) |g= |r0 + 0i
  81.  
  82. |r     0.1 - 0.5i, -0.24 - 0.1i, 0.476 + 0.48i, ··· |wis the orbit for |yz0 |g= |r0.1 - 0.5i
  83.  
  84. |wlet |yf(z) |g= |yz²
  85. |wlet   |yz0 |g= |r0 - 1i
  86.        |yz1 |g= |yf(z0) |g= |r(0 - 1i)² |g= |r-1
  87.        |yz2 |g= |yf(z1) |g= |rf²(z0)  |g= |r(-1)² |g= |r1
  88.        |w:
  89.        :
  90.        |yz5 |g= |yf(z4) |g= |r1
  91.  
  92.        |r0 - 1i, -1, 1, 1, 1, ··· |wis the orbit for |yz0 |g=|r 0 - 1i
  93.  
  94.  
  95. |wBut how can you tell if an initial seed |yz0|w will
  96. go to zero or infinity?
  97.  
  98. Here is how:
  99. |rFirst|w, we must convert the complex number into a |rREAL|w
  100. number so that we can use the |rREAL|w square rules.
  101. |y│z0│|w is the distance on the complex plane from the origin
  102. |r(0,0i)|w to the point |y (x0,y0i)|w. It is the |rABSOLUTE VALUE|w
  103. of |yz0|w
  104. It is a |rREAL|w number.
  105.  
  106. |y│z0│|w can be determined using the |rPythagorean theorem|w:
  107. |y│z0│ |g= |y√(x0² + y0i²)
  108. |w where x0 is the real part of the imaginary number,
  109. and y0 is the complex part (z = a + bi, x0 = a, y0 = b)
  110.  
  111. |wThus, the square rules for a |rCOMPLEX |wseed |yz0 |wcan be written:
  112. |y1. |wif |y│z0│|g >|r 1 |wthen the orbit will |yescape to infinity
  113. 2. |wif |y│z0│ |g< |r1 |wthen the orbit will |ygo to 0
  114. 3. |wif |y│z0│ |g= |r1 |wthen the orbit |ywill go to 1|r
  115.  
  116. @Press [ENTER] if you are hopelessly lost...
  117. |wWhen we were talking about the |rvon Koch|w curve, we said
  118. that all you did was repetitively replace segments with
  119. triangles. This is known as a |gTRANSFORMATION.
  120. |wTransformations can also be done using functions.
  121. The function |rf(z) = z² + c|w |a(where c is a complex constant
  122. for example 1.05 + 2.05i)|w is the basis of |gfractal geometry.|w
  123.  
  124. As we saw above, the function |rf(z) = z²|w followed three rules
  125. when iterated - |rboring.|w But the function |rf(z) = z² + c|w
  126. doesn't follow such rules! In fact, it is |rinfinitely complex
  127. |wwhich you know by now is a property of |rfractals.
  128.  
  129. |wBut how do we |gSEE|w fractals?
  130. To see the fractal described by |rf(z) = z² + c|w, we pick
  131. a value of |yc|w, then we |giterate|w the |gfunction|r f(z)|w for
  132. different seed values of |yz(0)|w and see if |rf(z)|w converges
  133. on a number |a(such as 1 or 0)|w or |ggoes to infinity|w.
  134. We pick values of |yz(0)|w on the Cartesian plane |a(X-Y plane)|w
  135. so if we have a 10 x 10 plane, we plug in:
  136.  
  137. |gz(0) = -5 + 5i, z(0) = -5 + 4i, ..., z(0) = 5 + -5i|w
  138.  
  139. In other words, we |ycheck every point on the plane|w
  140. and see |ywhat it does when iterated.|w
  141.  
  142. If it |gdoes not go to infinity|w, we color it |rblack|w,
  143. the ones that |ggo to infinity|w, we color |rwhite|w.
  144. Each picture is different depending on the value
  145. of c, that complex constant.
  146. The following is a fractal created with
  147. |yc|g = |r-0.122 + 0.745i|r
  148.  
  149. @Press [ENTER] to view...
  150. ~bwfrac.pcx
  151. |wAll those black points were places where the iterated
  152. function |rconverged to a number.|w
  153.  
  154. If we want to get fancy, we can use |rcolor|w to
  155. |genhance|w the fractal.
  156.  
  157. Instead of plotting the points that |yconverge|w, we
  158. plot the points that go to infinity.
  159. We use a |ydifferent color|w to represent the number of
  160. iterations it took to reach infinity.
  161. (e.g. 1 iteration is blue, 2 iterations is red, etc)
  162. Look at the same fractal colored in.|r
  163.  
  164. @Press [ENTER] and select the first demo please...
  165. \instruc.fee
  166. |wThis type of fractal, where we pick an initial c value
  167. is known as a |rJulia|w fractal, named for French
  168. Mathematician |rGaston Julia.|r
  169.  
  170. @Press [ENTER] to see some sample BASIC code...
  171. |wThe following is a simple |rBASIC|w program 
  172. that draws a |rJulia|w fractal by the above method:|g
  173.  
  174. 10        INPUT "Real Part: ", CX
  175. 20        INPUT "Complex Part: ", CY
  176. 30        SCREEN 1
  177. 40        FOR A = 0 TO 100
  178. 50        FOR B = 0 TO 100
  179. 60                X0 = -2 + A / 25
  180. 70                Y0 = 2 - B / 25
  181. 80                I = 1
  182. 90                WHILE I < 20
  183. 100                        X1 = X0 * X0 - Y0 * Y0 + CX
  184. 110                        Y1 = 2 * X0 * Y0 + CY
  185. 120                        IF X1 * X1 + Y1 * Y1 > 4 THEN GOTO 180
  186. 130                        X0 = X1
  187. 140                        Y0 = Y1
  188. 150                        I = I + 1
  189. 160                WEND
  190. 170                GOTO 190
  191. 180                PSET (A, B), 5
  192. 190       NEXT B
  193. 200       NEXT A
  194.  
  195. |wTry it out yourself! Those 20 lines of code were what
  196. started this whole thing!|r
  197.  
  198. @If that was all easy, press [ENTER]...
  199. |wNow, an IBM researcher named |rBenoit Mandelbrot|w
  200. decided it would be nice to see what the fractal
  201. would look like that resulted from |yfixing|w z0
  202. to be equal to |g0 + 0i|w instead of the points on
  203. the plane, and using |yc|w to represent the points
  204. on the plane.
  205.  
  206. The function is then iterated in a similar fashion.
  207. The result is the famous |rMANDELBROT SET.
  208.  
  209. @Press [ENTER] and select the second demo to see it!
  210. \instruc.fee
  211. |wThere is only one possible true Mandelbrot set, since
  212. |yz0|w is fixed at |g0 + 0i|w and |yc|w is always the points on
  213. the plane.
  214. But there are infinitely many |gJulia sets|w, since any
  215. initial value of |yc|w can be used.
  216. Be sure to check out the |rSHOW ME!|w example file
  217. to see some great |gMandelbrot|w and |gjulia fractals.|r
  218.  
  219. @But what about those cool PLASMA fractals?
  220. |wPlasma fractals are also created by |giterating
  221. a procedure,|w but not a complex function as in
  222. Mandelbrot and Julia fractals.
  223.  
  224. To create a |rPlasma|w fractal, the computer picks
  225. |rrandom|w colors for the corners of a box.
  226. It then subdivides this box into four smaller boxes.
  227. The colors of these boxes are determined by an
  228. average of the colors of their corners, plus a random
  229. amount.
  230. So now we have |gcolored boxes|w!
  231.  
  232. The program then divides each of these boxes
  233. into 4 smaller ones, and colors them by the
  234. same method, adding a random value each time.
  235. The amount of randomness is determined by
  236. the |rRoughness Constant|w that is input before
  237. the plasma is drawn.
  238.  
  239. The program divides until each box is the size
  240. of one dot (or |gpixel|w) on the screen.
  241. You are left with an amazing fractal cloud.
  242.  
  243. If we correspond each color to a different
  244. 3-d height, these |ysmooth fractal clouds|w
  245. are an amazingly real depiction of |rmountainous
  246. landscapes. |wThe mountain on the title screen
  247. was created with a plasma fractal!|r
  248.  
  249. @Press [ENTER] and select the third demo to see a PLAMSA fractal.
  250. \instruc.fee
  251. |wNow, check out a 3-D landscape
  252. created with a plasma fractal!|r
  253. @Press [ENTER]...
  254. ~fracmnt.pcx
  255. |w
  256. Be sure to read some of the other sections for more
  257. information on ÅÉæÆôæös!|r
  258.  
  259. @Press [ENTER] to return to menu...
  260.